Encontré un problema en el que intentaba derivar una clave de 256 bits de una contraseña de entrada con la esperanza de usarla con crypto.createCipheriv/createDecipheriv. Esto me da el siguiente error: [ERR_INVALID_ARG_TYPE]: the "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Recieved undefined No estoy seguro de por qué... this.key = crypto.scrypt(this.passphrase, 'baewithsalt',256, (err)=>{if(err) throw err;}); cuando se usa en... this.decipher = crypto.createDecipher(this.algorithm, this.key, this.iv); me dice que la clave no está definida. Tengo estas variables inicializadas justo encima de eso... this.passphrase ='whatever'; this.algorithm = 'aes-256-cbc'; this.iv =crypto.randomBytes(16); ¿Qué estoy haciendo mal y por qué no puedo usar scrypt para generar una clave a partir de una contraseña para cipheriv/decipheriv? Pido disculpas si el formato puede estar ligeramente desviado, no tengo Internet y lo escribí a través de mi teléfono.